#include <bits/stdc++.h>
using namespace std;
int x[300001];
int y[300001];
using LL = long long;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
  }
  long long ans = 0;
  /*   for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        ans += abs(x[j] - x[i]) + abs(y[j] - y[i]);
      }
    } */

  sort(x + 1, x + n + 1);
  sort(y + 1, y + n + 1);

  for (int i = 1; i <= n; i++) {
    ans += -(LL)(n - i) * x[i] + (LL)(i - 1) * x[i] - (LL)(n - i) * y[i] +
           (LL)(i - 1) * y[i];
  }

  cout << ans;
  return 0;
}